package com.xu.crawler.dao.impl;

import com.xu.crawler.dao.entity.NewsDO;
import com.xu.crawler.dao.NewsDao;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by clear on 2018/7/11.
 */
@Repository
public class NewsDaoImpl implements NewsDao {

    @Resource
    private MongoTemplate mongoTemplate;

    @Override
    public void saveNews(NewsDO newsDO) {
        mongoTemplate.save(newsDO);
    }

    @Override
    public void batchSaveNews(List<NewsDO> newsDOs) {
        mongoTemplate.insertAll(newsDOs);
    }
}
